package com.imstlife.vending.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.imstlife.vending.R;

public class KeyAdapter extends RecyclerView.Adapter<KeyAdapter.KeyHolder> {

    private String[] keys=new String[]{"1","2","3","4","5","6","7","8","9","删除","0","确定"};
    @Override
    public KeyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new KeyHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_key,parent,false));
    }

    @Override
    public void onBindViewHolder(KeyHolder holder, int position) {
        holder.tv.setText(keys[position]);
    }

    @Override
    public int getItemCount() {
        return keys.length;
    }

    class KeyHolder extends RecyclerView.ViewHolder{

        public TextView tv;

        public KeyHolder(View itemView) {
            super(itemView);
            tv = (TextView) itemView.findViewById(R.id.tv_item_key);
        }
    }
}
